﻿@using WD.Db.Contract
@using WD.Web
@using WD.Web.MVC.Common
@model List<int>
@{
    var funList = ServiceContext.Current.Rbac_FunctionModelService.GetRbac_FunctionModelListByUserId(AdminUserContext.Current.LoginInfo.UserID).ToList();
    var lev1List = funList.Where(x => x.ModelLevel == CommonCode.功能模块级别_一级模块).OrderBy(x => x.Sort).ToList();
    if (Model != null)
    {
        lev1List = lev1List.Where(x => Model.Contains(x.ID)).ToList();
    }
}
<ul class="nav nav-pills nav-stacked">
    @foreach (var fun in lev1List)
    {
        <li>
            <a href="#" class="dropdown-toggle">
                <i class="fa @fun.Icon"></i>
                <span>@fun.ModelName</span>
                <i class="fa fa-chevron-circle-right drop-icon"></i>
            </a>
            @{
        var parentId = fun.ModelID;
        var lev2List = funList.Where(x => x.ParentID == parentId).OrderBy(x => x.Sort).ToList();
        if (lev2List.Any())
        {
                <ul class="submenu">
                    @foreach (var fun2 in lev2List)
                    {
                        <li>
                            <a href="@fun2.Url" rel="@fun2.ID" onclick="OpenTab({url:this.href,rel:this.rel,title:'@fun2.ModelName'});return false;" >
                                <i class="fa @fun2.Icon"></i>
                                <span>@fun2.ModelName</span>
                            </a>
                        </li>
                    }
                </ul>
        }
            }
        </li>
    }
</ul>
